package study.transaction.atomikos.support.datasource;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class DataSourceConfig {

    @Bean(initMethod = "init", destroyMethod = "close")
    @ConfigurationProperties(prefix = "datasource.user")
    public AtomikosDataSourceBean user_ds() {
        AtomikosDataSourceBean dataSourceBean = new AtomikosDataSourceBean();
        return dataSourceBean;
    }

    @Bean
    @ConfigurationProperties(prefix = "datasource.account")
    public AtomikosDataSourceBean account_ds() {
        AtomikosDataSourceBean dataSourceBean = new AtomikosDataSourceBean();
        return dataSourceBean;
    }
}
